package com.briup.ch13;

import java.lang.annotation.Annotation;

/**
 * @Author briup-adam
 * @Date 2023/10/31 上午8:16
 * @Description
 **/

public class GetClassMessage {
    public static void main(String[] args) {
        Class<Cat> catClass = Cat.class;
        //获取父类
        Class<? super Cat> superclass = catClass.getSuperclass();
        System.out.println(superclass.toGenericString());
        //获取实现的接口
        Class<?>[] interfaces = catClass.getInterfaces();
        for (Class<?> anInterface : interfaces) {
            System.out.println(anInterface);
        }
        //获取当前类型上的所有注解
        Annotation[] annotations = catClass.getAnnotations();
        for (Annotation annotation : annotations) {
            System.out.println(annotation);
        }
        //获取当前类的包
        Package aPackage = catClass.getPackage();
        System.out.println(aPackage);
        //获取基本类名
        String simpleName = catClass.getSimpleName();
        System.out.println(simpleName);
        //获取全限定类名
        String name = catClass.getName();
        System.out.println(name);
    }
}
